<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>学院计划</title>
  <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-touch-fullscreen" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
  <link rel="stylesheet" type="text/css" th:href="@{css/materialdesignicons.min.css}">
  <link rel="stylesheet" type="text/css" th:href="@{css/bootstrap.min.css}">
  <link rel="stylesheet" type="text/css" th:href="@{css/animate.min.css}">
  <link rel="stylesheet" type="text/css" th:href="@{css/style.min.css}">
  <link rel="stylesheet" href="layui-v2.5.6/layui/css/layui.css" media="all">
</head>

<body>
<div th:include="comm/comm.html"></div>
    <!--页面主要内容-->
    <main class="lyear-layout-content">
      
      <div class="container-fluid p-t-15">
        
        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-body">
                
                <form  class="row" id="formss" method="post">
                  <div class="form-group col-md-12">
                    <label for="type">栏目</label>
                    <div class="form-controls">
                      <select name="type" class="form-control" id="type">
                        <option value="3">计划</option>
                        <option value="4">记录</option>
                      </select>
                    </div>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="title">标题</label>
                    <input type="text" class="form-control" id="title" name="title" value="" placeholder="请输入标题" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="title">书籍名称</label>
                    <input type="text" class="form-control" id="bookname" name="bookname" value="" placeholder="书籍名称" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="title">作者</label>
                    <input type="text" class="form-control" id="author" name="author" value="" placeholder="作者" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="seo_keywords">关键词</label>
                    <input type="text" class="form-control" id="seo_keywords" name="keyword" value="" placeholder="关键词" />
                  </div>
                  <div class="form-group col-md-12">
                    <label for="seo_description">描述</label>
                    <textarea class="form-control" id="seo_description" name="describe" rows="5" value="" placeholder="描述"></textarea>
                  </div>
                  <div class="form-group col-md-12">

                    <label>图片上传</label>

                    <div class="form-controls">
                      <ul class="list-inline row lyear-uploads-pic mb-0">
                        <li class="col-6 col-md-4 col-lg-2">
                          <figure>
                            <img src="images/gallery/15.jpg" alt="图片一">
                            <figcaption>
                              <a class="btn btn-round btn-square btn-primary" href="#!"><i class="mdi mdi-eye"></i></a>
                              <a class="btn btn-round btn-square btn-danger" href="#!"><i class="mdi mdi-delete"></i></a>
                            </figcaption>
                          </figure>
                        </li>
                        <li class="col-6 col-md-4 col-lg-2">
                          <figure>
                            <img src="images/gallery/16.jpg" alt="图片二">
                            <figcaption>
                              <a class="btn btn-round btn-square btn-primary" href="#!"><i class="mdi mdi-eye"></i></a>
                              <a class="btn btn-round btn-square btn-danger" href="#!"><i class="mdi mdi-delete"></i></a>
                            </figcaption>
                          </figure>
                        </li>
                        <li class="col-6 col-md-4 col-lg-2">
                          <figure>
                            <img src="images/gallery/17.jpg" alt="图片三">
                            <figcaption>
                              <a class="btn btn-round btn-square btn-primary" href="#!"><i class="mdi mdi-eye"></i></a>
                              <a class="btn btn-round btn-square btn-danger" href="#!"><i class="mdi mdi-delete"></i></a>
                            </figcaption>
                          </figure>
                        </li>
                        <button type="button" class="layui-btn" id="test1" name="file">
                          <i class="layui-icon">&#xe67c;</i>上传图片
                        </button>

                      </ul>
                    </div>
                  </div>

                  <div class="form-group col-md-12">
                    <label >状态</label>
                    <div class="clearfix">
                      <div class="custom-control custom-radio custom-control-inline">
      	              <input type="radio" id="statusOne" name="customRadioInline" class="custom-control-input"value="0">
      	              <label class="custom-control-label" for="statusOne">禁用</label>
      	            </div>
      	            <div class="custom-control custom-radio custom-control-inline">
      	              <input type="radio" id="statusTwo" name="customRadioInline" value="1" class="custom-control-input" checked>
      	              <label class="custom-control-label" for="statusTwo">启用</label>
      	            </div>
                    </div>
                  </div>
                  <div class="form-group col-md-12">
                    <button onclick="add()" class="btn btn-primary" >确 定</button>
                    <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
                  </div>
                </form>
              </div>
            </div>
          </div>
          
        </div>
        
      </div>
    
    </main>
    <!--End 页面主要内容-->
  </div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.min.js"></script>
<!--标签插件-->
<!--<script src="js/jquery-tagsinput/jquery.tagsinput.min.js"></script>-->
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript" src="layui-v2.5.6/layui/layui.js"></script>
<script>
    layui.use('upload', function(){
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: 'ironur' //上传接口
            ,done: function(res){
               alert(res)
            }
            ,error: function(){
                //请求异常回调
                alert(1)
            }
        });
    });
    function add(){
            var serialize = $("#formss").serialize();
            console.log(serialize)
           $.ajaxSettings.async=false
            $.ajax({
                url:'bookadd',
                type:'POST',
                data:serialize,
                datatype:"json",
                success:function (a) {
                       if (a==1){
                        alert("添加成功！")
                    } else {
                        alert("添加失败！")
                    }
                },
                error:function () {
                    alert("传输失败！")
                }

            })
        }


</script>
</body>
</html>